addOnPlayedListener

abstract fun addOnPlayedListener(@NonNull listener: OnPlayedListener)

Registers an OnPlayedListener to receive notifications when media items are played by the player.

This listener is invoked each time a piece of content (e.g., video, image, audio) is played, providing details about the media item. This can be used for logging playback, custom analytics, or triggering actions based on content playback.

Ensure removeOnPlayedListener is called when the listener is no longer required to prevent potential memory leaks.

Parameters

listener

The non-null OnPlayedListener instance to register.

See also

Throws

if listener is null.